home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 5387 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.3 KB  |  51 lines

  1. Path: academy.bastad.se!news
  2. From: sten@academy.bastad.se (Sten Jansson)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: detachable program
  5. Date: 13 Mar 1996 17:20:18 GMT
  6. Organization: Connection Bastad
  7. Message-ID: <773.6646T648T1645@academy.bastad.se>
  8. References: <Pine.BSD.3.91.960310002355.23759B-100000@ugly.cute.fi>
  9. NNTP-Posting-Host: academy.bastad.se
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=iso-8859-1
  12. Content-Transfer-Encoding: 8bit
  13. X-Newsreader: THOR 2.22 (Amiga;TCP/IP) *UNREGISTERED*
  14.  
  15.  
  16. >Help me!
  17. >I want to know how to make a program that detaches itself from CLI
  18.  
  19. I have given it a thought too. I think you should use LoadSeg() and
  20. CreateProc(). I made a little test program in C:
  21. --
  22. #include <exec/types.h>
  23. #include <dos/dos.h>
  24. #include <proto/exec.h>
  25. #include <proto/dos.h>
  26.  
  27. void main()
  28. {
  29.  BPTR SEGMENT;
  30.  UBYTE *NAME="c:requestfile",*NAME_PROC="my_proc";
  31.  struct MsgPort  *PROCESS;
  32.  SEGMENT=LoadSeg(NAME);
  33.  if(!SEGMENT)
  34.  {
  35.  printf("%d\n",IoErr());
  36.  exit(0);
  37.  }
  38.  PROCESS=CreateProc(NAME_PROC,40,SEGMENT,10000);
  39.  if(!PROCESS)
  40.   printf("%d\n",IoErr());
  41.  exit(0);
  42.  
  43. }
  44. --
  45. However I only managed to run a few program e.g. requestfile.
  46. Please tell me if You manage to make it work properly! Write me a Email
  47. then , 'cos I don't get all the letters in news.
  48.  
  49. Sten
  50.  
  51.